package com.iwhalecloud.bss.kite.cucc.service.attr.linkhandler;

import com.iwhalecloud.bss.kite.common.util.KiteStringUtils;
import com.iwhalecloud.bss.kite.cucc.service.attr.handler.ElectronAttrHandler;
import com.iwhalecloud.bss.kite.cucc.service.attr.handler.VpnCateIdAttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.annotation.AttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.impl.AbstractAttrLinkageHandler;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttrValue;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @version V1.0
 * @author:lxb
 * @Package
 * @date:2021/4/15
 */
@Service
@AttrHandler(ElectronAttrHandler.class)
public class ElectronAttrLinkHandler extends AbstractAttrLinkageHandler<AttrData> {
    @Override
    public void handle(KiteAttr kiteAttr, KiteInst kiteInst, AttrData attrData) {
        KiteAttr attr29=kiteInst.getAttr("200002829");//主线号
        KiteAttr attr30=kiteInst.getAttr("200002830");//用途标志
        KiteAttr attr57=kiteInst.getAttr("200002757");//专网类型
        KiteAttr attr31=kiteInst.getAttr("200002831");//终端地址数量
        KiteAttr attr32=kiteInst.getAttr("200002832");//互联地址段
        KiteAttr attr71=kiteInst.getAttr("2_0000071");//接口类型

        if(KiteStringUtils.equalsAny(kiteAttr.getValue(),"100004680","100004681")){
            attr29.setShowType("D");
            if(KiteStringUtils.equalsAny(kiteAttr.getValue(),"100004680")){
                attr30.setShowType("D");
            } else{
                attr30.setShowType("E");
            }
            if(KiteStringUtils.equalsAny(kiteAttr.getValue(),"100004681")){
                attr57.setShowType("D");
                attr31.setShowType("D");
                attr32.setShowType("D");
                attr71.setShowType("D");
            }else{
                attr57.setShowType("E");
                attr31.setShowType("E");
                attr32.setShowType("E");
                attr71.setShowType("E");
            }
        }else {
            attr29.setShowType("E");
        }
 /*       operateSceneInstService.setAttr(data.getSceneInstId(), inst.getInstType(), inst.getInstId(), attr29);
        operateSceneInstService.setAttr(data.getSceneInstId(), inst.getInstType(), inst.getInstId(), attr30);
        operateSceneInstService.setAttr(data.getSceneInstId(), inst.getInstType(), inst.getInstId(), attr57);
        operateSceneInstService.setAttr(data.getSceneInstId(), inst.getInstType(), inst.getInstId(), attr31);
        operateSceneInstService.setAttr(data.getSceneInstId(), inst.getInstType(), inst.getInstId(), attr32);
        operateSceneInstService.setAttr(data.getSceneInstId(), inst.getInstType(), inst.getInstId(), attr71);*/

    }

    @Override
    public void handleStyle(KiteAttr kiteAttr, KiteInst kiteInst, AttrData attrData) {

    }
}
